x86/vMSI-X: avoid missing first unmask of vectors
authorJan Beulich <jbeulich@suse.com>
Tue, 26 Apr 2016 09:52:22 +0000 (11:52 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 26 Apr 2016 09:52:22 +0000 (11:52 +0200)
commit3a6222bd57209d4c2f098d61ace042370a9b0a96
treeb5c59fb160ce885b3337de7d8512ff6fb6e88b0b
parent488c2a860a6d7eb69f4acfeb349b457aaba76dfa
x86/vMSI-X: avoid missing first unmask of vectors

Recent changes to Linux result in there just being a single unmask
operation prior to expecting the first interrupts to arrive. However,
we've had a chicken-and-egg problem here: Qemu invokes
xc_domain_update_msi_irq(), ultimately leading to
msixtbl_pt_register(), upon seeing that first unmask operation. Yet
for msixtbl_range() to return true (in order to msixtbl_write() to get
invoked at all) msixtbl_pt_register() must have completed.

Deal with this by snooping suitable writes in msixtbl_range() and
triggering the invocation of msix_write_completion() from
msixtbl_pt_register() when that happens in the context of a still in
progress vector control field write.

Note that the seemingly unrelated deletion of the redundant
irq_desc->msi_desc check in msixtbl_pt_register() is to make clear to
any compiler version used that the "msi_desc" local variable isn't
being used uninitialized. (Doing the same in msixtbl_pt_unregister() is
just for consistency reasons.)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/hvm/vmsi.c
xen/include/asm-x86/hvm/vcpu.h